<%@page contentType="text/html;charset=utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<title>登录 - 当当网</title>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<link href="../css/login.css" rel="stylesheet" type="text/css" />
		<link href="../css/page_bottom.css" rel="stylesheet" type="text/css" />
		<script type="text/javascript" src="../js/jquery-1.4.3.js"></script>
		<script type="text/javascript">
		var flag1=false;
		var flag2=false;
			//检验邮箱
			$(function(){
				$("#txtUsername").blur(function(){
					//1.非空检查
					//2.格式检查
					var email = $("#txtUsername").val();
					var pattern=/\b(^['_A-Za-z0-9-]+(\.['_A-Za-z0-9-]+)*@([A-Za-z0-9-])+(\.[A-Za-z0-9-]+)*((\.[A-Za-z0-9]{2,})|(\.[A-Za-z0-9]{2,}\.[A-Za-z0-9]{2,}))$)\b/;
					if(email==""){
						$("#errorMsg").html("邮箱不能为空").css("color","red");
						return;
					}else if(!pattern.test(email)){
						$("#errorMsg").html("邮箱格式错误").css("color","red");
						return;
					}else{
					flag1=true;
					}
				});
			});
			//检验密码
			$(function(){
				$("#txtPassword").blur(function(){
					var password = $("#txtPassword").val();
					if(password==""){
						$("#errorMsg").html("密码不能为空").css("color","red");
						return;
					}else{
					flag2=true;
					}
				});
			});
			$(function(){
				$("#txtUsername").focus(function(){
					$("#txtUsername").val("");
					$("#errorMsg").html("");
				});
			});
			$(function(){
				$("#txtPassword").focus(function(){
					$("#errorMsg").html("");
				});
			})
			//检查输入的邮箱密码是否正确
			$(function(){
				$("#btnSignCheck").submit(function(){
					return flag1&&flag2;
				}); 
			});
		</script>
	</head>
	<body>


		<%@include file="../common/head1.jsp"%>

		<div class="enter_part">

			<%@include file="../common/introduce.jsp"%>

			<div class="enter_in">
				<div class="bj_top"></div>
				<div class="center">
					<div style="height: 30px; padding: 5px; color: red" id="divErrorMssage">
					
					</div>
					<div class="main">
						<h3>
							登录当当网
						</h3>

						<form method="post" action="login.action" id="ctl00">
							<ul>
								<li>
									<span>请输入Email地址：</span>
									<input type="text" name="name" id="txtUsername" class="textbox" />
									
								</li>
								<li>
									<span class="blank">密码：</span>
									<input type="password" name="password" id="txtPassword"class="textbox" />
								</li>
								<li>
									<input type="submit" id="btnSignCheck" class="button_enter"
										value="登 录" />
								</li>
								<b><li align="center" id="errorMsg"><font color="red">${error_m}</font></li></b>
							</ul>
							<input type="hidden" name="uri" value="${uri}" />
						</form>
					</div>
					<div class="user_new">
						<p>
							您还不是当当网用户？
						</p>
						<p class="set_up">
							<a href="register_form.jsp">创建一个新用户&gt;&gt;</a>
						</p>
					</div>
				</div>
			</div>
		</div>

		<%@include file="../common/foot1.jsp"%>

	</body>
</html>

